package com.dq.tree;

import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class TreeNode implements TreeNodeInterface<TreeNode> {
    public Integer val = 0;
    public TreeNode left = null;
    public TreeNode right = null;
    public TreeNode(int val) {
        this.val = val;
    }
    @Override
    public TreeNode getLeft() {
        return this.left;
    }

    @Override
    public TreeNode getRight() {
        return this.right;
    }

    public String toString() {
        return "["+this.val+"]";
    }

    public static void main(String[] args) {
        Integer[] a = new Integer[]{1,2,5,3,4,null,6};
        TreeNode root = Tree.proATree(a);
        TreeUtil.PrintFromTopToBottom(root);
        TreeUtil.pirnt(root);
    }
}
